<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <title>用户地址列表</title>
    <link rel="stylesheet" type="text/css" th:href="@{/layui/css/layui.css}" media="all"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/news.css}" media="all"/>
</head>
<body class="childrenBody">
<blockquote class="layui-elem-quote news_search">
    <form id="searchForm" name="searchForm" class="layui-form" action="/user/addressEntry.html">
        <input type="hidden" id="pageNum" name="pageNum" th:value="${page}?${page.pageNum}"/>
        <div class="layui-form-item" style="margin-left: -24px;margin-top: 5px;margin-bottom: 5px;">
            <label class="layui-form-label">手机号:</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="telephone" th:value="${vo}?${vo.telephone}"/>
            </div>
            <label class="layui-form-label" style="margin-left: -20px;">联系人:</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="contact" th:value="${vo}?${vo.contact}"/>
            </div>
            <label class="layui-form-label" style="margin-left: -4px;">用户昵称:</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="userNickName" th:value="${vo}?${vo.userNickName}"/>
            </div>
            <button class="layui-btn search_btn"><i class="layui-icon">&#xe615;</i>查询</button>
        </div>
    </form>
</blockquote>
<div class="layui-form news_list">
    <table class="layui-table">
        <colgroup>
            <col/>
            <col/>
            <col/>
            <col/>
            <col/>
            <col/>
            <col/>
            <col/>
        </colgroup>
        <thead>
        <tr>
            <th>用户OpenId</th>
            <th>用户昵称</th>
            <th>联系人</th>
            <th>联系电话</th>
            <th>联系地址</th>
            <th>是否默认</th>
            <th>创建时间</th>
            <!-- <th>操作</th> -->
        </tr>
        </thead>
        <tbody class="news_content">
        <th:block th:if="${not #lists.isEmpty(page.list)}">
            <tr th:each="item:${page.list}">
                <td th:text="${item.openId}"></td>
                <td th:text="${item.userNickName}"></td>
                <td th:text="${item.contact}"></td>
                <td th:text="${item.telephone}"></td>
                <td th:text="${item.address}"></td>
                <th:block th:switch="${item.isDefault}">
                    <td th:case="0">否</td>
                    <td th:case="1">是</td>
                </th:block>
                <td th:text="${#dates.format(item.createTime,'yyyy-MM-dd HH:mm:ss')}"></td>
                <!-- <td>
                    <a th:data="${item.id}" class="layui-btn layui-btn-mini info"> 查看</a>
                </td> -->
            </tr>
        </th:block>
        </tbody>
    </table>
</div>
<div id="paged" align="right"></div>
<script type="text/javascript" th:src="@{/layui/layui.js}"></script>
<script type="text/javascript" th:src="@{/jquery/jquery-3.2.1.min.js}"></script>
</body>
<script th:inline="javascript">
    layui.use(['laypage', 'laydate'], function () {
        var laypage = layui.laypage, $ = layui.jquery;
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#startTime' //指定元素
            , format: 'yyyy-MM-dd HH:mm:ss'
        });
        //执行一个laydate实例
        laydate.render({
            elem: '#endTime' //指定元素
            , format: 'yyyy-MM-dd HH:mm:ss'
        });
        //执行一个laypage实例
        laypage.render({
            elem: 'paged', //注意，这里的 test1 是 ID，不用加 # 号
            curr: [[${page.pageNum}]],
            count: [[${page.total}]], //数据总数，从服务端得到
            layout: ['count', 'prev', 'page', 'next'],
            jump: function (obj, first) {
                //得到了当前页，用于向服务端请求对应数据
                var curr = obj.curr;
                $("#pageNum").val(curr);
                if (!first) {
                    $("#searchForm").submit();
                }
            }
        });
    });
</script>
</html>